﻿//********************************************************************************//
//创建日期：<创建日期，2010-08-02>
//创建作者：<王一飞，wangyifei@shanghai3h.com>
//功能说明：YS_LH_FENHUXX实体层次
//********************************************************************************//

#region Entity

using System;
using System.Data;
using Entity;
using Oracle.DataAccess.Client;
using Platform.Configuration;
using Platform.Data;

namespace Entity
{
    [Serializable]
    public class YS_LH_FENHUXX
    {
        private decimal? m_dec_i_jlzt;

        private decimal? m_dec_i_m1;

        private decimal? m_dec_i_m10;

        private decimal? m_dec_i_m11;

        private decimal? m_dec_i_m12;

        private decimal? m_dec_i_m2;

        private decimal? m_dec_i_m3;

        private decimal? m_dec_i_m4;

        private decimal? m_dec_i_m5;

        private decimal? m_dec_i_m6;

        private decimal? m_dec_i_m7;

        private decimal? m_dec_i_m8;

        private decimal? m_dec_i_m9;

        private decimal? m_dec_i_y;

        private decimal m_dec_id;

        private DateTime m_DT_d_caozuorq;

        private string m_str_s_caozuor;

        private string m_str_s_jicai;

        private string m_str_s_jieshui;

        private string m_str_s_laihanbh;

        private string m_str_s_shenpi;

        private string m_str_s_yewuy;

        private string m_str_s_yonghuh;

        private string m_str_s_yonghuhfather;

        private string m_str_s_zhuren;

        /// <summary>
        ///     主键
        /// </summary>
        public decimal ID
        {
            get { return m_dec_id; }
            set { m_dec_id = value; }
        }

        /// <summary>
        ///     来函编号
        /// </summary>
        public string S_LAIHANBH
        {
            get { return m_str_s_laihanbh; }
            set { m_str_s_laihanbh = value; }
        }

        /// <summary>
        ///     用户号
        /// </summary>
        public string S_YONGHUH
        {
            get { return m_str_s_yonghuh; }
            set { m_str_s_yonghuh = value; }
        }

        /// <summary>
        ///     父用户号   从哪个用户号分出来的
        /// </summary>
        public string S_YONGHUHFATHER
        {
            get { return m_str_s_yonghuhfather; }
            set { m_str_s_yonghuhfather = value; }
        }

        /// <summary>
        ///     水量年
        /// </summary>
        public decimal? I_Y
        {
            get { return m_dec_i_y; }
            set { m_dec_i_y = value; }
        }

        /// <summary>
        /// </summary>
        public decimal? I_M1
        {
            get { return m_dec_i_m1; }
            set { m_dec_i_m1 = value; }
        }

        /// <summary>
        /// </summary>
        public decimal? I_M2
        {
            get { return m_dec_i_m2; }
            set { m_dec_i_m2 = value; }
        }

        /// <summary>
        /// </summary>
        public decimal? I_M3
        {
            get { return m_dec_i_m3; }
            set { m_dec_i_m3 = value; }
        }

        /// <summary>
        /// </summary>
        public decimal? I_M4
        {
            get { return m_dec_i_m4; }
            set { m_dec_i_m4 = value; }
        }

        /// <summary>
        /// </summary>
        public decimal? I_M5
        {
            get { return m_dec_i_m5; }
            set { m_dec_i_m5 = value; }
        }

        /// <summary>
        /// </summary>
        public decimal? I_M6
        {
            get { return m_dec_i_m6; }
            set { m_dec_i_m6 = value; }
        }

        /// <summary>
        /// </summary>
        public decimal? I_M7
        {
            get { return m_dec_i_m7; }
            set { m_dec_i_m7 = value; }
        }

        /// <summary>
        /// </summary>
        public decimal? I_M8
        {
            get { return m_dec_i_m8; }
            set { m_dec_i_m8 = value; }
        }

        /// <summary>
        /// </summary>
        public decimal? I_M9
        {
            get { return m_dec_i_m9; }
            set { m_dec_i_m9 = value; }
        }

        /// <summary>
        /// </summary>
        public decimal? I_M10
        {
            get { return m_dec_i_m10; }
            set { m_dec_i_m10 = value; }
        }

        /// <summary>
        /// </summary>
        public decimal? I_M11
        {
            get { return m_dec_i_m11; }
            set { m_dec_i_m11 = value; }
        }

        /// <summary>
        /// </summary>
        public decimal? I_M12
        {
            get { return m_dec_i_m12; }
            set { m_dec_i_m12 = value; }
        }

        /// <summary>
        ///     0正常  1删除
        /// </summary>
        public decimal? I_JLZT
        {
            get { return m_dec_i_jlzt; }
            set { m_dec_i_jlzt = value; }
        }

        /// <summary>
        ///     操作人
        /// </summary>
        public string S_CAOZUOR
        {
            get { return m_str_s_caozuor; }
            set { m_str_s_caozuor = value; }
        }

        /// <summary>
        ///     操作日期
        /// </summary>
        public DateTime D_CAOZUORQ
        {
            get { return m_DT_d_caozuorq; }
            set { m_DT_d_caozuorq = value; }
        }

        /// <summary>
        ///     业务员意见
        /// </summary>
        public string S_YEWUY
        {
            get { return m_str_s_yewuy; }
            set { m_str_s_yewuy = value; }
        }

        /// <summary>
        ///     主任意见
        /// </summary>
        public string S_ZHUREN
        {
            get { return m_str_s_zhuren; }
            set { m_str_s_zhuren = value; }
        }

        /// <summary>
        ///     节水意见
        /// </summary>
        public string S_JIESHUI
        {
            get { return m_str_s_jieshui; }
            set { m_str_s_jieshui = value; }
        }

        /// <summary>
        ///     计财意见
        /// </summary>
        public string S_JICAI
        {
            get { return m_str_s_jicai; }
            set { m_str_s_jicai = value; }
        }

        /// <summary>
        ///     步骤选中审批结果
        /// </summary>
        public string S_SHENPI
        {
            get { return m_str_s_shenpi; }
            set { m_str_s_shenpi = value; }
        }
    }
}

#endregion

#region EntityProcess

namespace BLL.Access
{
    //using System.Data.OracleClient;

    public class YS_LH_FENHUXXProcess
    {
        #region Field

        protected string conn;

        #endregion

        #region Construction

        public YS_LH_FENHUXXProcess()
        {
            conn = ConfigHelper.PlatformConnString;
        }

        #endregion

        #region public

        /// <summary>
        ///     根据YS_LH_FENHUXX实体添加或者修改YS_LH_FENHUXX信息
        /// </summary>
        public bool InsertOrUpdate(YS_LH_FENHUXX YS_LH_FENHUXX, OracleTransaction Transaction)
        {
            if (YS_LH_FENHUXX.ID == 0)
                InsertYS_LH_FENHUXX(YS_LH_FENHUXX, Transaction);
            else
                UpdateYS_LH_FENHUXX(YS_LH_FENHUXX, Transaction);
            return YS_LH_FENHUXX.ID == 0 ? false : true;
        }

        /// <summary>
        ///     根据YS_LH_FENHUXX实体添加或修改YS_LH_FENHUXX信息
        /// </summary>
        public bool InsertOrUpdate(YS_LH_FENHUXX YS_LH_FENHUXX)
        {
            return InsertOrUpdate(YS_LH_FENHUXX, null);
        }


        /// <summary>
        ///     根据YS_LH_FENHUXX主键删除YS_LH_FENHUXX信息
        /// </summary>
        /// <param name="ID"></param>
        public bool DeleteYS_LH_FENHUXX(decimal ID, OracleTransaction Transaction)
        {
            var spName = "CS_DelYS_LH_FENHUXX";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = ID;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }

        /// <summary>
        ///     根据YS_LH_FENHUXX主键删除YS_LH_FENHUXX信息
        /// </summary>
        /// <param name="ID"></param>
        public bool DeleteYS_LH_FENHUXX(decimal ID)
        {
            return DeleteYS_LH_FENHUXX(ID, null);
        }

        /// <summary>
        ///     根据条件删除YS_LH_FENHUXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(Oracle语句)不带where</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>如果删除成功，返回true,否则返回fals</returns>
        public bool DeleteYS_LH_FENHUXXesDynamic(string WhereClause, OracleTransaction Transaction)
        {
            var spName = "CS_DelYS_LH_FENHUXXesDyn";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = WhereClause;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }

        /// <summary>
        ///     根据条件删除YS_LH_FENHUXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(Oracle语句)不带where</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>如果删除成功，返回true,否则返回fals</returns>
        public bool DeleteYS_LH_FENHUXXesDynamic(string WhereClause)
        {
            return DeleteYS_LH_FENHUXXesDynamic(WhereClause, null);
        }

        /// <summary>
        ///     根据YS_LH_FENHUXX主键选择YS_LH_FENHUXX信息
        /// </summary>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>YS_LH_FENHUXX信息</returns>
        public YS_LH_FENHUXX SelectYS_LH_FENHUXX(decimal ID, OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_LH_FENHUXX";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = ID;
            OracleDataReader rd;
            if (Transaction == null)
                rd = OracleHelper.ExecuteReader(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                rd = OracleHelper.ExecuteReader(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (rd.Read())
            {
                var YS_LH_FENHUXX = PopulateYS_LH_FENHUXX(rd);
                rd.Close();
                return YS_LH_FENHUXX;
            }
            return null;
        }

        /// <summary>
        ///     根据YS_LH_FENHUXX主键选择YS_LH_FENHUXX信息
        /// </summary>
        /// <returns>YS_LH_FENHUXX信息</returns>
        public YS_LH_FENHUXX SelectYS_LH_FENHUXX(decimal ID)
        {
            return SelectYS_LH_FENHUXX(ID, null);
        }

        /// <summary>
        ///     选择所有YS_LH_FENHUXX信息
        /// </summary>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>所有YS_LH_FENHUXX信息</returns>
        public DataTable SelectYS_LH_FENHUXXesAll(OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_LH_FENHUXXesAll";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            DataSet ds = null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (ds != null && ds.Tables.Count > 0)
            {
                AddRowNumber(ds.Tables[0]);
                return ds.Tables[0];
            }
            return null;
        }

        /// <summary>
        ///     选择所有YS_LH_FENHUXX信息
        /// </summary>
        /// <returns>所有YS_LH_FENHUXX信息</returns>
        public DataTable SelectYS_LH_FENHUXXesAll()
        {
            return SelectYS_LH_FENHUXXesAll(null);
        }

        /// <summary>
        ///     根据条件选择YS_LH_FENHUXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>YS_LH_FENHUXX信息</returns>
        public DataTable SelectYS_LH_FENHUXXesDynamic(string WhereClause, string OrderByExpression,
            OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_LH_FENHUXXesDyn";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = string.IsNullOrEmpty(WhereClause.Trim()) ? "1=1" : WhereClause;
            storedParams[1].Value = OrderByExpression;
            DataSet ds = null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (ds != null && ds.Tables.Count > 0)
            {
                AddRowNumber(ds.Tables[0]);
                return ds.Tables[0];
            }
            return null;
        }


        /// <summary>
        ///     根据条件选择YS_LH_FENHUXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <returns>YS_LH_FENHUXX信息</returns>
        public DataTable SelectYS_LH_FENHUXXesDynamic(string WhereClause, string OrderByExpression)
        {
            return SelectYS_LH_FENHUXXesDynamic(WhereClause, OrderByExpression, null);
        }


        /// <summary>
        ///     根据条件选择YS_LH_FENHUXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="PageIndex">页码</param>
        /// <param name="PageSize">页数</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>YS_LH_FENHUXX信息</returns>
        public DataTable SelectYS_LH_FENHUXXesDynamic(string WhereClause, string OrderByExpression, int PageIndex,
            int PageSize, OracleTransaction Transaction)
        {
            var spName = "CS_SelYS_LH_FENHUXXesDynPaged";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = string.IsNullOrEmpty(WhereClause.Trim()) ? "1=1" : WhereClause;
            storedParams[1].Value = OrderByExpression;
            storedParams[2].Value = PageIndex;
            storedParams[3].Value = PageSize;
            DataSet ds = null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (ds != null && ds.Tables.Count > 0)
            {
                AddRowNumber(ds.Tables[0]);
                return ds.Tables[0];
            }
            return null;
        }


        /// <summary>
        ///     根据条件选择YS_LH_FENHUXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="PageIndex">页码</param>
        /// <param name="PageSize">页数</param>
        /// <returns>YS_LH_FENHUXX信息</returns>
        public DataTable SelectYS_LH_FENHUXXesDynamic(string WhereClause, string OrderByExpression, int PageIndex,
            int PageSize)
        {
            return SelectYS_LH_FENHUXXesDynamic(WhereClause, OrderByExpression, PageIndex, PageSize, null);
        }

        /// <summary>
        ///     根据条件更新YS_LH_FENHUXX字段
        /// </summary>
        /// <returns>受影响行数</returns>
        public int UpdateYS_LH_FENHUXXesDynamic(string UpdateValue, string WhereClause, OracleTransaction Transaction)
        {
            var result = 0;
            if (UpdateValue == "" || WhereClause == "")
                return 0;
            var spName = "CS_UpdYS_LH_FENHUXXDyn";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            DataSet ds = null;
            storedParams[0].Value = UpdateValue;
            storedParams[1].Value = WhereClause;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                ds = OracleHelper.ExecuteDataset(Transaction, CommandType.StoredProcedure, spName, storedParams);
            result = Convert.ToInt32(storedParams[2].Value);
            return result;
        }

        /// <summary>
        ///     根据条件更新YS_LH_FENHUXX字段
        /// </summary>
        /// <returns>受影响行数</returns>
        public int UpdateYS_LH_FENHUXXesDynamic(string UpdateValue, string WhereClause)
        {
            return UpdateYS_LH_FENHUXXesDynamic(UpdateValue, WhereClause, null);
        }

        #endregion

        #region Private

        private int InsertYS_LH_FENHUXX(YS_LH_FENHUXX YS_LH_FENHUXX, OracleTransaction Transaction)
        {
            var spName = "CS_InsYS_LH_FENHUXX";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = YS_LH_FENHUXX.S_LAIHANBH;
            storedParams[1].Value = YS_LH_FENHUXX.S_YONGHUH;
            storedParams[2].Value = YS_LH_FENHUXX.S_YONGHUHFATHER;
            storedParams[3].Value = YS_LH_FENHUXX.I_Y;
            storedParams[4].Value = YS_LH_FENHUXX.I_M1;
            storedParams[5].Value = YS_LH_FENHUXX.I_M2;
            storedParams[6].Value = YS_LH_FENHUXX.I_M3;
            storedParams[7].Value = YS_LH_FENHUXX.I_M4;
            storedParams[8].Value = YS_LH_FENHUXX.I_M5;
            storedParams[9].Value = YS_LH_FENHUXX.I_M6;
            storedParams[10].Value = YS_LH_FENHUXX.I_M7;
            storedParams[11].Value = YS_LH_FENHUXX.I_M8;
            storedParams[12].Value = YS_LH_FENHUXX.I_M9;
            storedParams[13].Value = YS_LH_FENHUXX.I_M10;
            storedParams[14].Value = YS_LH_FENHUXX.I_M11;
            storedParams[15].Value = YS_LH_FENHUXX.I_M12;
            storedParams[16].Value = YS_LH_FENHUXX.I_JLZT;
            storedParams[17].Value = YS_LH_FENHUXX.S_CAOZUOR;
            storedParams[18].Value = YS_LH_FENHUXX.D_CAOZUORQ;
            storedParams[19].Value = YS_LH_FENHUXX.S_YEWUY;
            storedParams[20].Value = YS_LH_FENHUXX.S_ZHUREN;
            storedParams[21].Value = YS_LH_FENHUXX.S_JIESHUI;
            storedParams[22].Value = YS_LH_FENHUXX.S_JICAI;
            storedParams[23].Value = YS_LH_FENHUXX.S_SHENPI;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            YS_LH_FENHUXX.ID = Convert.ToInt32(storedParams[24].Value);
            return result;
        }

        private bool UpdateYS_LH_FENHUXX(YS_LH_FENHUXX YS_LH_FENHUXX, OracleTransaction Transaction)
        {
            var spName = "CS_UpdYS_LH_FENHUXX";
            var storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = YS_LH_FENHUXX.S_LAIHANBH;
            storedParams[1].Value = YS_LH_FENHUXX.S_YONGHUH;
            storedParams[2].Value = YS_LH_FENHUXX.S_YONGHUHFATHER;
            storedParams[3].Value = YS_LH_FENHUXX.I_Y;
            storedParams[4].Value = YS_LH_FENHUXX.I_M1;
            storedParams[5].Value = YS_LH_FENHUXX.I_M2;
            storedParams[6].Value = YS_LH_FENHUXX.I_M3;
            storedParams[7].Value = YS_LH_FENHUXX.I_M4;
            storedParams[8].Value = YS_LH_FENHUXX.I_M5;
            storedParams[9].Value = YS_LH_FENHUXX.I_M6;
            storedParams[10].Value = YS_LH_FENHUXX.I_M7;
            storedParams[11].Value = YS_LH_FENHUXX.I_M8;
            storedParams[12].Value = YS_LH_FENHUXX.I_M9;
            storedParams[13].Value = YS_LH_FENHUXX.I_M10;
            storedParams[14].Value = YS_LH_FENHUXX.I_M11;
            storedParams[15].Value = YS_LH_FENHUXX.I_M12;
            storedParams[16].Value = YS_LH_FENHUXX.I_JLZT;
            storedParams[17].Value = YS_LH_FENHUXX.S_CAOZUOR;
            storedParams[18].Value = YS_LH_FENHUXX.D_CAOZUORQ;
            storedParams[19].Value = YS_LH_FENHUXX.S_YEWUY;
            storedParams[20].Value = YS_LH_FENHUXX.S_ZHUREN;
            storedParams[21].Value = YS_LH_FENHUXX.S_JIESHUI;
            storedParams[22].Value = YS_LH_FENHUXX.S_JICAI;
            storedParams[23].Value = YS_LH_FENHUXX.S_SHENPI;
            storedParams[24].Value = YS_LH_FENHUXX.ID;
            var result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery(Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }


        private YS_LH_FENHUXX PopulateYS_LH_FENHUXX(IDataReader dr)
        {
            var YS_LH_FENHUXX = new YS_LH_FENHUXX();
            YS_LH_FENHUXX.ID = dr["ID"] == DBNull.Value ? 0 : (decimal) dr["ID"];
            YS_LH_FENHUXX.S_LAIHANBH = dr["S_LAIHANBH"] == DBNull.Value ? null : (string) dr["S_LAIHANBH"];
            YS_LH_FENHUXX.S_YONGHUH = dr["S_YONGHUH"] == DBNull.Value ? null : (string) dr["S_YONGHUH"];
            YS_LH_FENHUXX.S_YONGHUHFATHER =
                dr["S_YONGHUHFATHER"] == DBNull.Value ? null : (string) dr["S_YONGHUHFATHER"];
            YS_LH_FENHUXX.I_Y = dr["I_Y"] == DBNull.Value ? null : (decimal?) dr["I_Y"];
            YS_LH_FENHUXX.I_M1 = dr["I_M1"] == DBNull.Value ? null : (decimal?) dr["I_M1"];
            YS_LH_FENHUXX.I_M2 = dr["I_M2"] == DBNull.Value ? null : (decimal?) dr["I_M2"];
            YS_LH_FENHUXX.I_M3 = dr["I_M3"] == DBNull.Value ? null : (decimal?) dr["I_M3"];
            YS_LH_FENHUXX.I_M4 = dr["I_M4"] == DBNull.Value ? null : (decimal?) dr["I_M4"];
            YS_LH_FENHUXX.I_M5 = dr["I_M5"] == DBNull.Value ? null : (decimal?) dr["I_M5"];
            YS_LH_FENHUXX.I_M6 = dr["I_M6"] == DBNull.Value ? null : (decimal?) dr["I_M6"];
            YS_LH_FENHUXX.I_M7 = dr["I_M7"] == DBNull.Value ? null : (decimal?) dr["I_M7"];
            YS_LH_FENHUXX.I_M8 = dr["I_M8"] == DBNull.Value ? null : (decimal?) dr["I_M8"];
            YS_LH_FENHUXX.I_M9 = dr["I_M9"] == DBNull.Value ? null : (decimal?) dr["I_M9"];
            YS_LH_FENHUXX.I_M10 = dr["I_M10"] == DBNull.Value ? null : (decimal?) dr["I_M10"];
            YS_LH_FENHUXX.I_M11 = dr["I_M11"] == DBNull.Value ? null : (decimal?) dr["I_M11"];
            YS_LH_FENHUXX.I_M12 = dr["I_M12"] == DBNull.Value ? null : (decimal?) dr["I_M12"];
            YS_LH_FENHUXX.I_JLZT = dr["I_JLZT"] == DBNull.Value ? null : (decimal?) dr["I_JLZT"];
            YS_LH_FENHUXX.S_CAOZUOR = dr["S_CAOZUOR"] == DBNull.Value ? null : (string) dr["S_CAOZUOR"];
            YS_LH_FENHUXX.D_CAOZUORQ = dr["D_CAOZUORQ"] == DBNull.Value
                ? Convert.ToDateTime("1900-1-1")
                : (DateTime) dr["D_CAOZUORQ"];
            YS_LH_FENHUXX.S_YEWUY = dr["S_YEWUY"] == DBNull.Value ? null : (string) dr["S_YEWUY"];
            YS_LH_FENHUXX.S_ZHUREN = dr["S_ZHUREN"] == DBNull.Value ? null : (string) dr["S_ZHUREN"];
            YS_LH_FENHUXX.S_JIESHUI = dr["S_JIESHUI"] == DBNull.Value ? null : (string) dr["S_JIESHUI"];
            YS_LH_FENHUXX.S_JICAI = dr["S_JICAI"] == DBNull.Value ? null : (string) dr["S_JICAI"];
            YS_LH_FENHUXX.S_SHENPI = dr["S_SHENPI"] == DBNull.Value ? null : (string) dr["S_SHENPI"];
            return YS_LH_FENHUXX;
        }


        private void AddRowNumber(DataTable dt)
        {
            dt.Columns.Add(new DataColumn("RowNumber", typeof(int)));
            for (var i = 0; i < dt.Rows.Count; i++)
                dt.Rows[i][dt.Columns.Count - 1] = i + 1;
        }

        #endregion
    }
}

#endregion